/*
 * @Description: 侧边栏
 * @Author: Zzt
 * @Date: 2022-11-27 09:55:52
 * @LastEditTime: 2022-12-06 20:26:10
 */

import { Menu } from 'antd';
import classNames from 'classnames/bind';
import { useAccountContext } from '../contexts/AccountContext';
import type { IArchiveType } from '@/interfaces/archiveType';
import styles from '../styles/siderbar.module.scss';

const cx = classNames.bind(styles);

const Sidebar = () => {
  const { changeSidebar } = useAccountContext();
  const onSelect = ({ key, atList }: { key: string; atList?: IArchiveType[] }): void => {
    changeSidebar(key);
    console.log('key&atList', key, atList);
  };
  const items = [
    { label: '全部', key: 'all' }, // 菜单项务必填写 key
    { label: '全宗一览表', key: '1' },
    { label: '全宗档案总量一览表', key: '2' },
    { label: '立档单位保存档案情况', key: '3' },
    { label: '立档单位数字化成果情况统计表', key: '4' },
    { label: '接收档案情况统计表', key: '5' },
    { label: '立档单位移出档案数量情况统计表', key: '6' },
    { label: '征集档案数量情况统计表', key: '7' },
    { label: '立档单位销毁档案数量情况统计表', key: '8' },
    { label: '档案资料利用及编研成果数量情况统计表', key: '9' },
    { label: '国家档案馆开放档案和档案目录数量情况统计表', key: '10' },
    { label: '国家档案馆档案宣传、展览、编研和出版数量情况统计表', key: '11' },
    { label: '立档单位档案部门设施设备数量情况统计表', key: '12' },
    { label: '档案馆基本建设情况统计表', key: '13' },
    { label: '立档单位部门和国家档案编目及抢救情况统计表', key: '14' }
  ];

  return (
    <>
      <div className={cx('container')}>
        <h6 className={cx('fond-header')}>台账类型</h6>
        <div className={cx('fond-navs')}>
          <Menu
            mode="inline"
            onSelect={onSelect}
            style={{ width: 200, whiteSpace: 'normal', height: 'auto' }}
            defaultSelectedKeys={['all']}
            items={items}
          />
        </div>
      </div>
    </>
  );
};
export default Sidebar;
